﻿@model Tasks.UI.Models.Restaurant.RestaurantEditModel
@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>餐厅编辑</title>
    <link href="@Config.GetCssResourcePath("main.css")" rel="stylesheet" type="text/css" />
    <link href="@Config.GetCssResourcePath("table.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-impromptu.3.1.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/global.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $().ready(function () {
            $("#form").validate({
                showErrors: function (errorMap, errorList) {
                    $.Msg.errorTips("您的表单填写不完整:", 0, errorList);
                },
                rules: {
                    Name: "required"
                },
                messages: {
                    Name: "请输入餐厅名称"
                },
                /* 获得焦点时不验证 */
                focusInvalid: false,
                onfocusout: false,
                onkeyup: false
            });
        })
        function addRow(tbl) {
            var tr = $("#" + tbl + " tr").eq(1).clone();
            $(".PriceName", tr).val("");
            $(".Price", tr).val("0");
            tr.show();
            tr.appendTo("#" + tbl);
        }
        function delRow(src) {
            $.Msg.confirmDelete(function () {
                var row = $(src).parent().parent();
                row.remove();

            });
        }
        function goto(act) {
            $("#act").val(act);
            $("form").submit();
        }
        $(function () {
            initProvince("#ProvinceID");
            initCity("#CityID");
        })
       
    </script>
</head>
<body>
    @using (Html.BeginForm())
    {
        <input id="act" name="act" type="hidden" />
        @Html.HiddenFor(t => t.RestaurantID)
        <div id="container">
            <div class="navTitle">
                编辑餐厅信息
            </div>
            @Html.OutputMessage(Model.Message, Model.MessageType)
            <div id="horizontal" class="pageBody">              
                <table style="width: 100%;" border="0">
                    <tr>
                        <td style="width: 90px;">
                            <strong>餐厅名称：</strong>
                        </td>
                        <td style="width: 350px;">
                            @Html.TextBoxFor(t => t.Name)
                        </td>
                        <td style="width: 120px;">
                            <strong>付款方式：</strong>
                        </td>
                        <td>
                            @Html.DropDownList("PaymentMode", PageHelper.EnterprisePaymentModeSelector(Model.PaymentMode))
                        </td>
                    </tr>
                   
                    <tr>
                        <td>
                            <strong>联系人：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.Linkman)
                        </td>
                        <td>
                            <strong>单位性质:</strong>
                        </td>
                        <td>
                            @Html.DropDownList("Relation", PageHelper.RelationSelector(Model.Relation))
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>联系人手机：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.LinkmanMobile)
                        </td>
                        <td>
                            <strong>餐厅电话：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.LinkmanTel)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>所在区域：</strong>
                        </td>
                        <td>
                            @Html.DropDownList("ProvinceID", PageHelper.ProvinceSelector(Model.ProvinceID))
                            @Html.DropDownList("CityID", PageHelper.CitySelector(Model.CityID, Model.ProvinceID))
                            @Html.DropDownList("AreaID", PageHelper.AreaSelector(Model.AreaID, Model.CityID))
                        </td>
                        <td>
                            <strong>餐厅传真</strong>
                        </td>
                        <td>@Html.TextBoxFor(t => t.Fax)
                        </td>
                    </tr>
                    <!-- 一下信息用于地接系统 -->
                    <tr style="display: none;">
                        <td>
                            <strong>用餐价格：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.UnitPrice, new { @class = "r" })
                        </td>
                        <td>
                            <strong>返点 ：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.CommissionRate, new { @class = "r" })
                        </td>
                    </tr>
                    <tr style="display: none;">
                        <td>
                            <strong>成本价：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.CostPrice1, new { @class = "r" })
                            <span>元/人</span>
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr style="display: none;">
                        <td>
                            <strong>销售价 ：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.SellPrice1, new { @class = "r" })
                            <span>元/人</span>
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>地 址：</strong>
                        </td>
                        <td colspan="3">@Html.TextBoxFor(t => t.Address, new { style = "width:99%;" })
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>备注：</strong>
                        </td>
                        <td colspan="3">
                            @Html.TextAreaFor(t => t.Remark, new { style = "width:99%;height:60px;" })
                        </td>
                    </tr>
                </table>
                <br />
                <div class="navTitle">
                    报价
                </div>
                <table id="tb1" class="tblStyle1 textboxfull" style="width: 60%">
                    <thead>
                        <tr>
                            <th style="width: 40%;">
                                名称
                            </th>
                            <th style="width: 40%;">
                                价格（元/人）
                            </th>
                            <th style="width: 20%;">
                                操作
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @if (Model.RestaurantPriceList != null)
                        {
                            foreach (RestaurantPrice res in Model.RestaurantPriceList)
                            {
                            <tr>
                                <td>
                                    <input name="PriceName" type="text" value="@res.Name"  class="PriceName"/>
                                </td>
                                <td>
                                    <input name="Price" type="text" value="@res.Price" class="Price r"/>
                                </td>
                                <td class="c">
                                    <img src="/Images/icon/16x16/add.png" onclick="addRow('tb1')" />
                                    <img src="/Images/icon/16x16/delete.png" onclick="delRow(this)" />
                                </td>
                            </tr>
                            }
                        }
                    </tbody>
                </table>
                <div style="padding: 4px 0px;">
                    <a href="javascript:goto('save')" class="button big blue"><span>保存</span></a> <a
                        href="javascript:goto('apply')" class="button big blue"><span>应用</span></a>
                    <a href="javascript:closeTab()" class="button big blue"><span>关闭</span></a>
                </div>
            </div>
        </div>
    }
</body>
</html>
